<include file="Common/common" />
<style>
	.layui-table tbody tr:hover {background-color: transparent}
	.aaa{
		color:rgb(240,222,112);
	}

</style>

<?php 
	$pageArr = array('0'=>'总和','1'=>'第一球','2'=>'第二球','3'=>'第三球','4'=>'第四球','5'=>'第五球');
	$ballArr = array('0'=>'总和','1'=>'第一球','2'=>'第二球','3'=>'第三球','4'=>'第四球','5'=>'第五球');
	$whichArr = array('0'=>'大','1'=>'小','2'=>'单','3'=>'双');
?>
<body>

	<div class="layui-tab-item layui-show">
		<div class="layui-main">
			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			  	<legend style="color: rgb(240,222,112);"><img id="sound" style="width: 22px;" src="/Public/img/speaker-5.png" onclick="changesound()" alt=""> <span  id="newcodenum">{$newCode['code']}{$newCode['codenum']}</span>期开奖 <span id="newopencode">{$newCode['opencode']}</span>&nbsp;&nbsp;今日输赢:<span id="total_today">{$total_today}</span></legend>
			</fieldset>

			<blockquote class="layui-elem-quote layui-quote-nm">
				<span id="newCode1" style="color: rgb(240,222,112);">{$newCode['code']}</span><span id="newxCode" style="color: rgb(240,222,112);">{$nextCode}</span><span style="color: rgb(240,222,112);">期&nbsp;距离封盘：</span><span id="countDown1" style="color: green;"></span>&nbsp;&nbsp;<span style="color: rgb(240,222,112);">距离开奖：</span><span id="countDown2" style="color:red;"></span>
			</blockquote>

			<fieldset class="layui-elem-field">
				<legend style="color: rgb(240,222,112);">我的投注</legend>
				<input type="hidden" id="mycode">
				<div class="layui-field-box" id="mytouzhu">
					
				</div>
			</fieldset>

			<!-- <blockquote class="layui-elem-quote layui-quote-nm">
				期号：<span id="mycode">{$mynewtask['code']}{$mynewtask['codenum']}</span>&nbsp;我的投注：<span style="color:orange;" id="myneworder">{$pageArr[$mynewtask['user_guess']['0']]}-{$ballArr[$mynewtask['user_guess']['1']]}-{$whichArr[$mynewtask['user_guess']['2']]}</span>&nbsp;开奖号：<span id="myopencode">{$mynewtask['opencode']}</span>
				
			</blockquote> -->

			<form class="layui-form" action="{:U('/admin.php/User/user')}" method="post">
				<div class="layui-form-item">
					<label class="layui-form-label" style="color: rgb(240,222,112);">积分</label>
					<div class="layui-input-inline" >
						<input style="background: rgba(255,255,255,0.05);color: rgb(240,222,112);" type="text" placeholder="" id="money" name="money" lay-verify="required"  class="layui-input" >
					</div>
					<input type="hidden" name="uid" value="{$uid}">
					<input type="hidden" id="whichBall" name="whichBall" value="">
					<input type="hidden" name="code" value="{$newCode['code']}">
					<input type="hidden" name="codenum" value="{$nextCode}">

					<div class="layui-input-inline">
						<button id="btn-play"  style="background: rgb(35,38,46)" class="layui-btn" lay-submit="" lay-filter="btn-play"><span style="color: rgb(240,222,112);">确定</span></button>
						<button type="reset" style="background: rgb(35,38,46)" id="btn-reset" class="layui-btn"><span style="color: rgb(240,222,112);">重置</span></button>
					</div>
				</div>
			</form>

			
			<div class="layui-tab">
				<ul class="layui-tab-title">
					<li class="layui-this aaa">总和</li>
					<li class="aaa">第一球</li>
					<li class="aaa">第二球</li>
					<li class="aaa">第三球</li>
					<li class="aaa">第四球</li>
					<li class="aaa">第五球</li>
				</ul>
				<div class="layui-tab-content">
					<div class="layui-tab-item layui-show">
						
						<div class="layui-form" style="overflow-x: auto;">
							<table class="layui-table" style="background: rgba(255,255,255,0.05);">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody >
									<tr style="color: rgb(240,222,112);"> <th colspan="4"  style="text-align: center;">总和</th> </tr>
									<tr>
										<td style="color: rgb(240,222,112);"><p>总和大 | <span style="color:red;">1.998</span></p><input  style="background: rgba(255,255,255,0.05)" type="number" data-id="0-0-0" class="layui-input" disabled="" style=""></td>
										<td style="color: rgb(240,222,112);">总和小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-0-1" class="layui-input" disabled="" style=""></td>
										<td style="color: rgb(240,222,112);"> 总和单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-0-2" class="layui-input" disabled="" style=""></td>
										<td style="color: rgb(240,222,112);">总和双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-0-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>

							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr>
										<th>第一球</th>
										<th>第二球</th>
										<th>第三球</th>
										<th>第四球</th>
										<th>第五球</th>
									</tr>
									<tr>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-1-0" class="layui-input" disabled="" style=""></td>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)"  type="number" data-id="0-2-0" class="layui-input" disabled="" style=""></td>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)"  type="number" data-id="0-3-0" class="layui-input" disabled="" style=""></td>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)"  type="number" data-id="0-4-0" class="layui-input" disabled="" style=""></td>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)"  type="number" data-id="0-5-0" class="layui-input" disabled="" style=""></td>
									</tr>
									<tr>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-1-1" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-2-1" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-3-1" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-4-1" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-5-1" class="layui-input" disabled="" style=""></td>
									</tr>
									<tr>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-1-2" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-2-2" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-3-2" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-4-2" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-5-2" class="layui-input" disabled="" style=""></td>
									</tr>
									<tr>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-1-3" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-2-3" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-3-3" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-4-3" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="0-5-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
						</div>


						
					</div>

					<!-- 第一球 -->
					<div class="layui-tab-item">
						<div class="layui-form" style="overflow-x: auto;">
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)" >

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">总和</th> </tr>
									<tr>
										<td><p>总和大 | <span style="color:red;">1.998</span></p><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-0-0" class="layui-input" disabled="" style=""></td>
										<td>总和小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-0-1" class="layui-input" disabled="" style=""></td>
										<td>总和单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-0-2" class="layui-input" disabled="" style=""></td>
										<td>总和双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-0-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">第一球</th> </tr>
									<tr>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-1-0" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-1-1" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-1-2" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="1-1-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>

					<!-- 第二球 -->
					<div class="layui-tab-item">
						<div class="layui-form" style="overflow-x: auto;">
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">总和</th> </tr>
									<tr>
										<td><p>总和大 | <span style="color:red;">1.998</span></p><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-0-0" class="layui-input" disabled="" style=""></td>
										<td>总和小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-0-1" class="layui-input" disabled="" style=""></td>
										<td>总和单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-0-2" class="layui-input" disabled="" style=""></td>
										<td>总和双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-0-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">第二球</th> </tr>
									<tr>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-2-0" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-2-1" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-2-2" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="2-2-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<!-- 第三球 -->
					<div class="layui-tab-item">
						<div class="layui-form" style="overflow-x: auto;">
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">总和</th> </tr>
									<tr>
										<td><p>总和大 | <span style="color:red;">1.998</span></p><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-0-0" class="layui-input" disabled="" style=""></td>
										<td>总和小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-0-1" class="layui-input" disabled="" style=""></td>
										<td>总和单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-0-2" class="layui-input" disabled="" style=""></td>
										<td>总和双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-0-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">第三球</th> </tr>
									<tr>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-3-0" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-3-1" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-3-2" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="3-3-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<!-- 第四球 -->
					<div class="layui-tab-item">
						<div class="layui-form" style="overflow-x: auto;" >
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">总和</th> </tr>
									<tr>
										<td><p>总和大 | <span style="color:red;">1.998</span></p><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-0-0" class="layui-input" disabled="" style=""></td>
										<td>总和小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-0-1" class="layui-input" disabled="" style=""></td>
										<td>总和单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-0-2" class="layui-input" disabled="" style=""></td>
										<td>总和双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-0-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">第四球</th> </tr>
									<tr>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-4-0" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-4-1" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-4-2" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="4-4-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<!-- 第五球 -->
					<div class="layui-tab-item">
						<div class="layui-form" style="overflow-x: auto;">
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">总和</th> </tr>
									<tr>
										<td><p>总和大 | <span style="color:red;">1.998</span></p><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-0-0" class="layui-input" disabled="" style=""></td>
										<td>总和小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-0-1" class="layui-input" disabled="" style=""></td>
										<td>总和单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-0-2" class="layui-input" disabled="" style=""></td>
										<td>总和双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-0-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
							<table class="layui-table" style="color: rgb(240,222,112);background: rgba(255,255,255,0.05)">

								<colgroup>
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
									<col width="150">
								</colgroup>
								
								<tbody>
									<tr> <th colspan="4"  style="text-align: center;">第五球</th> </tr>
									<tr>
										<td>大 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-5-0" class="layui-input" disabled="" style=""></td>
										<td>小 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-5-1" class="layui-input" disabled="" style=""></td>
										<td>单 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-5-2" class="layui-input" disabled="" style=""></td>
										<td>双 | <span style="color:red;">1.998</span><input style="background: rgba(255,255,255,0.05)" type="number" data-id="5-5-3" class="layui-input" disabled="" style=""></td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>

			<table></table>
			<div class="layui-form">
			  	<table class="layui-table" style="background: rgba(255,255,255,0.05)">
			  		<colgroup>
				      <col width="100">
				      <col width="50">
				    </colgroup>
				    <thead style="color: rgb(240,222,112);">
				      	<tr style="background: rgba(255,255,255,0.05)" >
				        	<th colspan="4"  style="text-align: center;">长龙排行榜</th>
				      	</tr> 
				    </thead>
				    <tbody id="dragon-body">
				    	<foreach name="show_dragon" item='vo'>
					      	<tr style="color: rgb(240,222,112);">
						        <td>{$vo['name']}&nbsp;-&nbsp;{$vo['type']}</td>
						        <td>{$vo['val']}</td>
					      	</tr>
				      	</foreach>
				  	</tbody>
			  	</table>
			</div>
		</div>
	</div>
	<div id="audio"></div>
</body>
<script language="javascript" type="text/javascript">
	var score_recreation = {$score_recreation};
	var nextfeng_time = {$nextfeng};
	var nextime_time = {$nextime};
	var strtime = {$strtime};
	var audio_sound = 1;

	//自动播放
 	function autoPlay(){
     	var myAuto = document.getElementById('myaudio');
	     
     	myAuto.src = '/openaudio.mp3';//MP3路径
     	myAuto.play();
	};

	// 创建音频
	function createAuto(){
	    var _id = $("#audio");
	    if (window.applicationCache) {
         	_id.html('<audio id="myaudio" src="" controls="controls"  hidden="true"></audio>')
        } else {
            _id.html('<embed src="" id="myaudio" style="display: none;"></embed>'); 
       	}
 	};

 	createAuto();

 	function changesound(){
 		if (audio_sound == 1) {
 			audio_sound = 0;
 			$('#sound').attr('src','/Public/img/speaker-8.png');
 		}else{
 			audio_sound = 1;
 			$('#sound').attr('src','/Public/img/speaker-5.png');
 		}
 	};

	var  time = Date.parse(new Date());
	time = time.toString();
	time = time.substring(0,10);
	if (time >= strtime.start_time && time < strtime.end_time) {
		var countdown_time = 10;
	}else if (time >= strtime.end_time || time < strtime.endend_time) {
		var countdown_time = 5;
	}else{
		var countdown_time = 2;
	}
// console.log(countdown_time);

	$(document).ready(function() {	
      $("table td").click(function(){	
      		var userMoney = $("#money").val();	
          	// var a = $(this).text();		

          	$("#whichBall").val($(this).children().next().data('id'));
          	
          	$("table input").val('');
          	$(this).children().next().val(userMoney);
          	
          	
          	var nowbackground = $(this).css("background-color");


          	if (nowbackground == 'rgb(255, 165, 0)') {
          		
          		$("table td").css("background","");  //其他td为无色
          		$(this).css("background-color","rgba(0, 0, 0, 0)");
          		$("table input").val('');
          	}else{
          		
          		$("table td").css("background","");  //其他td为无色
          		$(this).css("background-color","orange");
          	}
          		
      	});
  	}); 


  	layui.use(['form'], function () {
     
        // 操作对象
        var form = layui.form;
        var $ = layui.jquery;

        form.on('submit(btn-play)',function (data) {
            // console.log(data.field);
            ballArr = data.field.whichBall.split("-");

            
            if (data.field.whichBall == '') {
                layer.msg('<span style="color: rgb(240,222,112);">未选择，无法确定</span>');
            	return false;
            }

            if (data.field.money.trim() < 1000) {
                layer.msg('<span style="color: rgb(240,222,112);">积分小于1000，无法投注</span>');
            	return false;
            }

            var residue = score_recreation - data.field.money.trim();
            if (residue < 0) {
                layer.msg('<span style="color: rgb(240,222,112);">您的积分不足，无法参与</span>');
            	return false;
            }


            var page = '';
            if (ballArr['0'] == 0) {
            	page = '总和';
            }else if(ballArr['0'] == 1){
            	page = '第一球';
            }else if(ballArr['0'] == 2){
            	page = '第二球';
            }else if(ballArr['0'] == 3){
            	page = '第三球';
            }else if(ballArr['0'] == 4){
            	page = '第四球';
            }else if(ballArr['0'] == 5){
            	page = '第五球';
            }

            var ball = '';
            if (ballArr['1'] == 0) {
            	ball = '总和';
            }else if(ballArr['1'] == 1){
            	ball = '第一球';
            }else if(ballArr['1'] == 2){
            	ball = '第二球';
            }else if(ballArr['1'] == 3){
            	ball = '第三球';
            }else if(ballArr['1'] == 4){
            	ball = '第四球';
            }else if(ballArr['1'] == 5){
            	ball = '第五球';
            }

            var status = '';
            if (ballArr['2'] == 0) {
            	status = '大';
            }else if(ballArr['2'] == 1){
            	status = '小';
            }else if(ballArr['2'] == 2){
            	status = '单';
            }else if(ballArr['2'] == 3){
            	status = '双';
            }
            var newCode1 = $("#newCode1").text();
            var newxCode = $("#newxCode").text();

            data.field.code = newCode1;
            data.field.codenum = newxCode;

            var confirm_msg = "<p>期数："+newCode1+newxCode+"</p><p>下注：1000</p><p>页面："+page+"</p><p>类型："+ball+"-"+status+"</p><p>确认信息无误后继续操作</p>";
            // console.log(data.field);
            layer.confirm(confirm_msg,{offset:'none',title:'下注清单'},function(index){
            	$.ajax({
	                type:'post',
	                url:"{:U('Recreation/ctrl_sscPlay')}",
	                data:data.field,
	                dataType:'json',
	                success:function (rtJson) {
	                    if (rtJson.code == 1){
	                    	// 我的投注信息
	                    	$("#mycode").val(rtJson.mycode);
	                    	// $("#myneworder").text(page+"-"+ball+"-"+status);
	                    	// $('#myopencode').tetx('');
	                    	var touzhumsg = '<span style="color: rgb(240,222,112);">我的投注：'+page+"-"+ball+"-"+status+'  期数：'+rtJson.mycode+'  投注积分：1000</span>';
	                    	$('#mytouzhu').text(touzhumsg);

	                        score_recreation = score_recreation - 1000;
	                        if (score_recreation <= 0) {
	                        	score_recreation = 0;
	                        }
	                        $("#par_score_recreation", window.parent.document).text(score_recreation);

	                        
	                        
	                    }
                        layer.msg('<span style="color: rgb(240,222,112);">'+rtJson.msg+'</span>');
	                }
	            })
            });
            
            return false;
        })
    });


	// 重置
  	$("#btn-reset").click(function(){
  		$("table td").css("background","");  //其他td为无色
  		$("#whichBall").val('');
  		$("table input").val('');
  	});

	



	var nowTime = new Date();
    var endTime = new Date(nextime_time * 1000);
    var endTime2 = new Date(nextfeng_time * 1000);
    var t = endTime.getTime() - nowTime.getTime();
    var tt = endTime2.getTime() - nowTime.getTime();

    var m = Math.floor(t/1000/60%60);
   	var s = Math.floor(t/1000%60);

   	var mm = Math.floor(tt/1000/60%60);
   	var ss = Math.floor(tt/1000%60);

   	var mmvar = '';
   	if (mm >= 0) {
   		getCountdown2();
   		mmvar = setInterval(function(){ getCountdown2() },1000);
   	}else{
   		$("#countDown1").html('已封盘');
    	// 无法操作点击确定
    	$('#btn-play').addClass("layui-btn-disabled").attr('disabled',"true");
   	}

	
    getCountdown();
    setInterval(function(){ getCountdown() },1000);
    


    function getCountdown (){
    	
    	if (m < countdown_time) {
    	 	m = ("0"+m).substr( -2 );
        }
        if (s < 10) {
         	s = ("0"+s).substr( -2 );
        }

    	var countDownTime =  m + ":" + s;
    	// console.log(countDownTime);
        $("#countDown2").html(countDownTime);
        if( m == 0 && s == 0 ){
            m = countdown_time - 1;
            s = 59;
            mm = countdown_time -2;
            ss = 59;

            var newxCode = $('#newxCode').text();
         	var newxCode = ( "00" + (newxCode*1 + 1) ).substr( -3 );
         	$("#newxCode").html(newxCode);
         	

            mmvar = setInterval(function(){ getCountdown2() },1000);
        }else if( m >= 0 ){

        	if (m == (countdown_time -2) && s == 30) {
	         	// ajax异步获取数据
	         	$.ajax({
	                type:'post',
	                url:"{:U('Recreation/ctrl_getssc')}",
	                data:{id:1},
	                dataType:'json',
	                success:function (rtJson) {
	                	if (rtJson.code == 1) {
	                    	console.log('ajax success');
	                    	// 播放提示音
	                    	if (audio_sound == 1) {
	                    		autoPlay();
	                    	}
	                    	var user_res = rtJson.user_res;
	                    	// 今日输赢
	                    	var total_today = $("#total_today").text();
	                    	if (user_res == 1) {
	                    		$("#total_today").text(total_today * 1 + 998);
	                    	}else if(user_res == 0){
	                    		$("#total_today").text(total_today * 1 - 1000);
	                    	}
	                    	
	                    	var show_dragon = rtJson.show_dragon;
	                    	var innerTD = '';
	                    	$("#dragon-body").empty();
	                    	$(show_dragon).each(function(index, item){
	                    		innerTD +="<tr><td>"+item.name+"&nbsp;-&nbsp;"+item.type+"</td><td>"+item.val+"</td></tr>";
	                    	});
	                    	$('#dragon-body').append(innerTD);


	                    	var newopencode = rtJson.newopencode.opencode;
	                    	var newcodenum = rtJson.newopencode.code + rtJson.newopencode.codenum;

	                    	$("#newcodenum").text(newcodenum);
	                    	$("#newopencode").text(newopencode);
	                    	var mycode = $("#mycode").val();
	                    	if (mycode == newcodenum) {
	                    	// 	$("#myopencode").text(newopencode);
	                    		$("#mytouzhu").empty();
	                    	}
	                    	


	                    	
	                	}else{

	                    	console.log('ajax error');
	                	}
	                }
	            });
	     	} 

	     	if ((m == 1 && s == 0) || (m == 0 && s <=59)) {
	     		$("#countDown1").html('已封盘');
		    	// 无法操作点击确定
		    	$('#btn-play').addClass("layui-btn-disabled").attr('disabled',"true");
	     		clearInterval(mmvar);
	     	}

            if( s > 0 ){
                s--;
            }else if( s == 0 ){
                m--;
                s = 59;
            }
        }
    }


    function getCountdown2 (){
    	


    	if (mm < countdown_time) {
    	 	mm = ("0"+mm).substr( -2 );
        }
        if (ss < 10) {
         	ss = ("0"+ss).substr( -2 );
        }
    	var countDownTime1 =  mm + ":" + ss;
        $("#countDown1").html(countDownTime1);

        if( mm == 0 && ss == 0 ){
            mm = countdown_time-2;
            ss = 59;
        }else if( mm >= 0 ){
        	$("#btn-play").removeClass('layui-btn-disabled').removeAttr('disabled',"true");

            if( ss > 0 ){
            	// console.log("ss:"+ss);
                ss--;
            }else if( ss == 0 ){
                mm--;
                ss = 59;
            }
        }
    }
  
</script>
<include file="Common/footer" />